<template>

 
 <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">主页面</el-breadcrumb-item>
          <el-breadcrumb-item>药剂管理</el-breadcrumb-item>
          <el-breadcrumb-item>疾病治疗</el-breadcrumb-item>
         </el-breadcrumb>
  <el-divider/>

  <el-descriptions title="牛的疾病治疗选择" :column="3"  border>

    <!-- 药品号 -->

    <el-descriptions-item label="牛的耳号" >

      <el-input v-model="quarantineLog.cattleId" style="width: 220px" placeholder="请输入牛的耳号" clearable />

    </el-descriptions-item>


    <el-descriptions-item label="药品名称">

 <el-input v-model="quarantineLog.pillName" style="width: 220px" placeholder="请输入药品名称" clearable />

    </el-descriptions-item>

    <el-descriptions-item label="检疫日期">

  <el-date-picker v-model="quarantineLog.quarantineDateValue" type="date" placeholder="请选择检疫日期" />

    </el-descriptions-item>

  </el-descriptions>

  <el-divider/>
  <!-- 添加按钮 -->

   <el-button type="primary" round @click="uesPill"  >使用</el-button>
   <!-- <el-button type="primary" round @click="findPillAll" >查询所有</el-button> -->
     <el-divider/>

    <el-table :data="tableData" style="width: 100%" height="250" border>
    <el-table-column fixed prop="cattleId" label="牛的耳号" width="250" sortable/>
    <el-table-column prop="pillName" label="药品名称" width="300" />
    <el-table-column prop="function" label="药品作用" width="280" />
    <el-table-column prop="quarantineDate" label="检疫日期" width="300" />
   
  </el-table>

   

</template>


<script setup lang="ts">

import axios from 'axios';
import { ref } from 'vue';



const  quarantineLog= ref({
 

  cattleId:'',

  pillId:'',
  pillName:'',

  quarantineDate:'',
  quarantineDateValue: null as Date | null, 

});

 const tableData = ref([]);


// function findPillAny() {

//       axios.get(`http://localhost:8080/pill/findPillById?pillId=${pill.value.pillId}`)

//         .then((response) => {

//           // 处理单个对象的结果
//             tableData.value = [response.data];

//         })

//         .catch((error) => {

//           console.error(error);


//         });

//     }

// function findPillAll() {

//       axios.get(`http://localhost:8080/pill/findPillAll`)

//         .then((response) => {

//           // 后端返回的是一个包含多个对象的数组，直接赋值给tableData

//           tableData.value = response.data;

//         })

//         .catch((error) => {

//           console.error(error);

//         });

//     }

</script>